package sessionBeans;

import entityBeans.User;
import java.util.List;


import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.jboss.ejb3.annotation.RemoteBinding;

/**
 *
 * @author user
 */
@Stateless
@RemoteBinding(jndiBinding="AuthenticationFacadeJNDI")
public class AuthenticationFacade extends User implements  AuthenticationFacadeLocal
{

	 @PersistenceContext(unitName = "sw2")
	    private EntityManager em;
       
     /**
		 * {@inheritDoc}
		 */
		public int loginFlag(String email, String password) {
			
			User user = em.find(User.class, email);
			
			if(user == null)
				return -1;
			
			if(user.getPassword().equals(password))
				return 1;
			
			return -1;
		}


	 
	 @Override
     public void forgetPassword(User user) {
             // TODO Auto-generated method stub
		 
		 
            
     }

	@Override
	public void login(User user) {
		// TODO Auto-generated method stub
		
	}



}